package com.yxplearn.mybatisplus.controller;


import com.yxplearn.mybatisplus.pojo.User;
import com.yxplearn.mybatisplus.pojo.UserRecord;
import com.yxplearn.mybatisplus.service.UserRecordService;
import com.yxplearn.mybatisplus.service.UserService;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Log4j2
@Controller
@RequestMapping("/transaction")
public class TransactionController {

    @Autowired
    UserService userService;

    @Autowired
    UserRecordService userRecordService;

    @RequestMapping("/insertUser")
    @ResponseBody
    public String insertUser() {
        User user = new User();
        user.setName("yxp");
        try {
            userService.saveOne(user);
        } catch (Exception exception) {
            exception.printStackTrace();
        }
//        try {
//            userRecordService.saveOne(new UserRecord());
//        } catch (Exception exception) {
//            exception.printStackTrace();
//        }
        return "ok";
    }
}
